﻿using sun.security.util;
using System;

namespace ConsoleApp1
{


    public class Program

    {
        //public static T BinarySeek(T[] numbers, T target)
        //{

        //    int left = 0, right = numbers.Length - 1, middle;
        //    while (left < right)
        //    {
        //        middle = (left + right) / 2;

        //        if (target.CompareTo(numbers[middle]) < 0)
        //        {
        //            right = middle - 1;
        //        }
        //        else if (target.CompareTo(numbers[middle]) > 0)
        //        {
        //            left = middle + 1;
        //        }
        //        else //if(target == numbers[middle])
        //        {
        //            return numbers[middle];
        //        }
        //    }
        //    return default(T);
        //}

        //用泛型改造“取数组中最大值”（提示：IComparable）
        public class Value<T> where T : IComparable<T>
        {
            public static T GetMaxValue(T[] numbers)
            {
                T max = default(T);
                for (int i = 0; i < numbers.Length; i++)
                {
                    if ( numbers[i].CompareTo(max) > 0)
                    {
                        max = numbers[i];
                    }
                }
                return default;
            }
            //double max = grade[0];

            //for (int i = 0; i < grade.Length; i++)
            //{
            //    if (grade[i] < min)
            //    {
            //        min = grade[i];
            //    }
            //    if (grade[i] > max)
            //    {
            //        max = grade[i];
            //    }
        }
        static void Main(string[] args)
        {


            //Person<int>.BinarySeek(new int[] { 1, 3, 5, 6, 8, 9 }, 8);

            //Person<Person> fg = new Person();

            //Person<int> person = new Person<int>();
            //person.Password = 1;
            //person.Grow<int>();

            //Console.WriteLine(typeof(Person<string>) == new Person<string>().GetType());





        }
    }
}


